﻿using Microsoft.EntityFrameworkCore.Diagnostics;
using System.Data.Common;

namespace AspNetCoreMvcPrj
{
    public class DamengNullInterceptor : DbCommandInterceptor
    {
        public override InterceptionResult<DbDataReader> ReaderExecuting(
            DbCommand command, CommandEventData eventData, InterceptionResult<DbDataReader> result)
        {
            // 将WHERE NULL转为WHERE 0=1等达梦兼容语法:ml-citation{ref="2" data="citationList"}
            command.CommandText = command.CommandText.Replace("WHERE NULL", "WHERE 0=1");
            return result;
        }
    }
}
